home *** CD-ROM | disk | FTP | other *** search
/ EuroCD 3 / EuroCD 3.iso / Programming / BlitzBasic / CIATrkrLib / SamplePrograms / TrackerTest.bb < prev   
Encoding:
Text File  |  1998-06-24  |  4.4 KB  |  197 lines

  1. ; Tracker Tester - The BEST way to check the CIATrackerLibrary!
  2. ;
  3. ;                   Version 1.00
  4. ;
  5. ;         Written by Crossbones/Binary Assault
  6. ;                    06/11/1995
  7. ;
  8. ; Requires the following libraries to be used:
  9. ; -NeilsReqToolsLib.obj
  10. ; -RIAmosFuncLib.obj
  11. ; -CIATrackerLib.obj (Duuh!)
  12. ;
  13. WBStartup:NoCli
  14.  
  15. Function DoRequest{text$}
  16.  success=RTEZRequest("Tracker Tester",text$,"Yes|No")
  17. Function Return success
  18. End Function
  19.  
  20. Function Decode{name$}
  21.   worked=False
  22.   If OpenFile(0,name$)
  23.     FileInput 0
  24.     size.l=Lof(0)
  25.     If Reserve(0,size.l+5,%10)=0 Then End
  26.     FileSeek 0,0
  27.     ReadMem 0,Start(0),size.l
  28.     PopInput
  29.     worked=True
  30.   EndIf
  31.   CloseFile 0
  32. Function Return worked
  33. End Function
  34.  
  35.  
  36. WbToScreen 0
  37. WBenchToFront_
  38.  
  39. BorderPens 2,1
  40. Borders On
  41.  
  42. LoadFont 0,"topaz.font",8
  43. Window 0,50,50,400,400,$2|$4|$8|$1000,"CIA Tracker Library Test - Version 1.0",0,1,1
  44. WindowFont 0
  45.  
  46. req$="First thing we need to do is find a"+Chr$(10)+"module to use. It must NOT be packed"+Chr$(10)+"in any form."
  47. success=RTEZRequest("Tracker Tester",req$,"OK!")
  48.  
  49. filename$=RTEZLoadFile("Module to use?","")
  50.  
  51. If OpenFile(0,filename$)
  52.   CloseFile 0
  53. Else
  54.   success=RTEZRequest("Tracker Test","Gosh! Was it that hard?","Weeell?!")
  55.   CloseWindow 0
  56.   End
  57. EndIf
  58.  
  59. For w=0 To 8
  60.    WCls
  61.    WColour 1,0:WLocate 1,1
  62.    NPrint "Currently Testing Slot#",Str$(w)
  63.    NPrint ""
  64.    FreeTrackerModule w
  65.    Print"Loading Module : ":WColour 2,0
  66.    If LoadTrackerModule(w,filename$)=False
  67.      NPrint "Failed!":Goto Error
  68.    EndIf
  69.    NPrint"Passed."
  70.    WColour 1,0
  71.    Print"Valid Module   : ":WColour 2,0
  72.    If CheckTrackerID(w)=True
  73.      NPrint"Passed."
  74.    Else
  75.      NPrint"Failed!"
  76.    EndIf
  77.    WColour 1,0
  78.    Print"Playing Module : ":WColour 2,0
  79.    success=StartTracker(w)
  80.    a=DoRequest{"Is the module playing?"}
  81.    If a=1
  82.      NPrint"Passed."
  83.    Else
  84.      NPrint"Failed!"
  85.      Pop If:Goto Error
  86.    EndIf
  87.    WColour 1,0
  88.    StopTracker
  89.    Print"Decoding Module: ":WColour 2,0
  90.    FreeTrackerModule w
  91.    If (Decode{filename$})=False
  92.      NPrint"Failed!"
  93.      Pop If:Goto Error
  94.    Else
  95.      NPrint"Passed."
  96.      DecodeModule w,Start(0)
  97.    EndIf
  98.    WColour 1,0
  99.    Print"Valid Module   : ":WColour 2,0
  100.    If CheckTrackerID(w)=True
  101.      NPrint"Passed."
  102.    Else
  103.      NPrint"Failed!"
  104.    EndIf
  105.    WColour 1,0
  106.    WColour 1,0
  107.    Print"Playing Module : ":WColour 2,0
  108.    success=StartTracker(w)
  109.    a=DoRequest{"Is the module playing?"}
  110.    If a=1
  111.      NPrint"Passed."
  112.    Else
  113.      NPrint"Failed!"
  114.      Pop If:Goto Error
  115.    EndIf
  116.    WColour 1,0
  117.    Print"Number/patterns: ":WColour 2,0
  118.      NPrint ModulePatterns(w)
  119.    WColour 1,0
  120.    Print"Jump Pattern   : ":WColour 2,0
  121.    trks=ModulePatterns(w):pos=Int(Rnd(1)*trks)+1
  122.    ModulePositionJump pos
  123.    a=DoRequest{"Did it just jump to another position?"}
  124.    If a=1
  125.      NPrint"Passed."
  126.    Else
  127.      NPrint"Failed!"
  128.      Pop If:Goto Error
  129.    EndIf
  130.    WColour 1,0
  131.    Print"Module Name    : ":WColour 2,0
  132.    name$=GetModuleName$(w)
  133.    If name$=""
  134.      NPrint"Failed! (Possible.)"
  135.    Else
  136.      Print "Passed. (":WColour 1,0:Print name$:WColour 2,0:NPrint")"
  137.    EndIf
  138.    WColour 1,0
  139.    Print"Pause Module   : ":WColour 2,0
  140.    PauseModule
  141.    a=DoRequest{"Did the module pause?"}
  142.    PauseModule
  143.    b=DoRequest{"Is the module playing again?"}
  144.    If a=1 AND b=1
  145.      NPrint "Passed."
  146.    Else
  147.      NPrint "Failed!"
  148.      Pop If:Goto Error
  149.    EndIf
  150.    WColour 1,0
  151.    Print"Volume Control : ":WColour 2,0
  152.    For v=64 To 0 Step -1:VWait:TrackerVolume v:Next v
  153.    a=DoRequest{"Did the volume go down?"}
  154.    For v=0 To 64:VWait:TrackerVolume v:Next v
  155.    b=DoRequest{"Did the volume go up?"}
  156.    If a=1 AND b=1
  157.      NPrint "Passed."
  158.    Else
  159.      NPrint "Failed!"
  160.      Pop If:Goto Error
  161.    EndIf
  162.    WColour 1,0
  163.    Print"Mask Control   : ":WColour 2,0
  164.    ChangeTrackerMask %1001
  165.    a=DoRequest{"Is the tracker only playing on one side?"}
  166.    ChangeTrackerMask %0110
  167.    b=DoRequest{"Is it now playing only on the other side?"}
  168.    ChangeTrackerMask %1111
  169.    c=DoRequest{"Is it now playing on both sides?"}
  170.    If a=1 AND b=1 AND c=1
  171.      NPrint "Passed."
  172.    Else
  173.      NPrint "Failed!"
  174.      Pop If:Goto Error
  175.    EndIf
  176.    WColour 1,0
  177.    FreeTrackerModule w:FreeBank 0
  178.    If w<>8
  179.      NPrint""
  180.      NPrint"** Press left mouse button to go on **"
  181.    Else
  182.      NPrint""
  183.      NPrint"      ** Test Finished! **"
  184.      NPrint""
  185.      NPrint"-Press left mouse button to exit-"
  186.    EndIf
  187.    ClickMouse
  188. Next w
  189. .Fin
  190. ClickMouse
  191. CloseWindow 0
  192. End
  193.  
  194. .Error
  195. success=RTEZRequest("Tracker Tester","Failure during the test","Shit!")
  196. Goto Fin
  197.